# Contributor: ScrumpyJack <scrumpyjack@st.ilet.to>
# Contributor: TBK <alpine@jjtc.eu>
# Maintainer: ScrumpyJack <scrumpyjack@st.ilet.to>
pkgname=gammu
pkgver=1.41.0
pkgrel=1
pkgdesc="Gammu provides an abstraction layer for cell phones access"
options="!check" # 466 - test_sql_time (Failed)
url="https://wammu.eu/"
arch="all"
license="GPL-2.0-or-later"
depends="bluez dialog"
makedepends="bluez-dev cmake curl-dev doxygen gettext-dev libdbi-dev libintl
	libusb-dev linux-headers mysql-dev postgresql-dev unixodbc-dev"
subpackages="$pkgname-smsd:_smsd $pkgname-doc $pkgname-dev
	$pkgname-libs $pkgname-lang"
source="https://dl.cihar.com/gammu/releases/gammu-$pkgver.tar.bz2
	include-sys-select-h.patch
	"

build() {
	cmake -B build . \
		-DCMAKE_BUILD_TYPE=None \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DWITH_NOKIA_SUPPORT=ON \
		-DWITH_BLUETOOTH=ON \
		-DWITH_IRDA=ON \
		-DLIBINTL_LIBRARIES=intl
	make -C build
}

check() {
	make -C build test
}

package() {
	make -C build DESTDIR="$pkgdir" install
}

_smsd() {
	pkgdesc="Gammu SMS daemon"

	cd "$builddir"
	mkdir -p "$subpkgdir"/usr/bin/
	mv "$pkgdir"/usr/bin/gammu-smsd \
	   "$pkgdir"/usr/bin/gammu-smsd-monitor \
	   "$pkgdir"/usr/bin/gammu-smsd-inject "$subpkgdir"/usr/bin
}

sha512sums="f2c2534d3827216bf015607431938e0cf2524d5f2c670a5f76bb5ab7928962d22de981bbbf2dfa7af833c7903b60a775242048210bac6c35b1a9ee7668db4543  gammu-1.41.0.tar.bz2
bcdbfa620dff24a01033bb670ec4dabae4c691224693d21105c6ca3cd30022b5825ad0669fd6325553b084d90bbde164113b08de7d102c7401d84076b9a59083  include-sys-select-h.patch"
